using Microsoft.Extensions.DependencyInjection;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Threading.Tasks;
using Zocono.WCS.Domain.DomainRepository;
using Zocono.WCS.Domain.EquipmentManageDomain;
using Zocono.WCS.Infrastructure.Repository;
using Zocono.WCS.WebApi;
using Zocono.WCS.WMSApiDomain;

namespace WcsTestProject
{
    [TestClass]
    public class UnitTest1 : WcsTestBase
    {
        [TestMethod]
        public void TestMethod1()
        {
            //var apiUrl = WmsApiConfigureManager.GetStringValue("WmsBaseWepApiUrl");

            //Console.WriteLine(apiUrl);
            //Assert.IsTrue(apiUrl == "http://172.17.0.1:8083/");
        }

        [TestMethod]
        public async Task TestInitPlanarEquipment()
        {
            ServiceCollection.AddScoped<IDispatchEquipmentService, DispatchEquipmentService>();
            ServiceCollection.AddScoped<IDispatchEquipmentRepository, DispatchEquipmentRepository>();

            ServiceCollection.AddScoped<IRouteInfoRepository, RouteInfoRepository>();
            ServiceCollection.AddScoped<IRouteDetailInfoRepository, RouteDetailInfoRepository>();

            //ISettingInit plannarInit = new PlanarEquipmentInit(ServiceProvider);
            //await plannarInit.Init();

            ISettingInit routeC1Init = new RouteGI1Init(ServiceProvider);
            await routeC1Init.Init();

            Assert.IsTrue(true);
        }

        [TestMethod]
        public async Task TestInitAreaGI()
        {
            ServiceCollection.AddScoped<IProgrameInfoRepository, ProgrameInfoRepository>();
            ServiceCollection.AddScoped<IJobInfoRepository, JobInfoRepository>();
            ServiceCollection.AddScoped<IPlcConnectionInfoRepository, PlcConnectionInfoRepository>();
            ServiceCollection.AddScoped<IPlcReadDbInfoRepository, PlcReadDbInfoRepository>();
            ServiceCollection.AddScoped<IBytesMapObjectInfoRepository, BytesMapObjectInfoRepository>();
            ServiceCollection.AddScoped<IPlcWriteDbInfoRepository, PlcWriteDbInfoRepository>();

            ServiceCollection.AddScoped<IRouteInfoRepository, RouteInfoRepository>();
            ServiceCollection.AddScoped<IRouteDetailInfoRepository, RouteDetailInfoRepository>();

            ServiceCollection.AddScoped<IPlanarProcessServiceMapInfoRepository, PlanarProcessServiceMapInfoRepository>();
            

            //ServiceIOC.AddService(ServiceCollection);

            //ISettingInit areaGIInit = new AreaGIInit(ServiceProvider);
            //await areaGIInit.Init();
            var areaGIInit = new AreaGIInit(ServiceProvider);
            await areaGIInit.InitMap();

            //ISettingInit routeC1Init = new RouteGI1Init(ServiceProvider);
            //await routeC1Init.Init();
        }
    }
}
